import React, { Component } from 'react'
import { Route, Switch } from 'react-router-dom'
import { IRoutes, loadable } from '../../routes'
import PersonalCenter from '../../store/action/PersonalCenter'
import './index.less'

export default class LoginPage extends Component<any, any> {

    private router: IRoutes[] = [
        {
            component: import('../../store/action/My/MyCollection'),
            path: '/My/collection' // 收藏 
        },
        {
            component: import('../../store/action/My/Follow'),
            path: '/My/follow' // 关注
        },
        {
            component: import('../../store/action/My/Footprint'),
            path: '/My/footprint' // 足迹
        },
        {
            component: import('../../store/action/My/Message'),
            path: '/My/message' // 消息
        },
        {
            component: import('./MyOperation/Promotions'),
            path: '/My/promotionsMsg' // 消息 --> 促销消息
        },
        {
            component: import('./MyOperation/AccountMsg'),
            path: '/My/accountMsg' // 消息 --> 账号消息
        },
        {
            component: import('./MyOperation/Logistics'),
            path: '/My/logisticsMsg' // 消息 --> 物流消息
        },
        {
            component: import('./MyOperation/SystemMsg'),
            path: '/My/systemMsg' // 消息 --> 系统消息
        },
        {
            component: import('../../store/action/My/Order'),
            path: '/My/myOrder' // 我的订单
        },
        {
            component: import('../../store/action/My/ObligationsDetail'),
            path: '/My/obligationsDetail/:id' // 我的订单 --> 待付款订单详情
        },
        {
            component: import('./MyOrder/DelivergoodsDetail'),
            path: '/My/delivergoodsDetail/:id' // 我的订单 --> 待发货订单详情
        },
        {
            component: import('./MyOrder/ReceivedDetail'),
            path: '/My/receivedDetail/:id' // 我的订单 --> 已收货订单详情
        },
        {
            component: import('./MyOrder/OrderCompleteDetail'),
            path: '/My/orderCompleteDetail/:id' // 我的订单 --> 已完成订单详情
        },
        {
            component: import('./MyOrder/OrderCancelDetail'),
            path: '/My/orderCancelDetail/:id' // 我的订单 --> 已取消订单详情
        },
        {
            component: import('../../store/action/My/OrderLogistics'),
            path: '/My/orderLogistics/:orderId' // 我的订单 --> 订单物流信息
        },
        {
            component: import('../../store/action/My/Returnpolicy'),
            path: '/My/returnpolicy/' // 退换货
        },
        {
            component: import('../../store/action/My/CustomerService'),
            path: '/My/customerService' // 退换货 --> 选择退换货
        },
        {
            component: import('../../store/action/My/CustomerServiceDetail'),
            path: '/My/customerServiceDetail/' // 退换货 --> 申请售后
        },
        {
            component: import('../../store/action/My/BarterDetail'),
            path: '/My/barterDetail' // 退换货 --> 申请售后
        },
        {
            component: import('./MyOrder/CustomerServiceResult'),
            path: '/My/customerServiceResult/:id/:type/:time' // 退换货 --> 提交成功
        },
        {
            component: import('./MyOrder/CustomerServiceProcess'),
            path: '/My/customerServiceProcess' // 退换货 --> 进度查询
        },
        {
            component: import('../../store/action/My/Invoice'),
            path: '/My/Invoice' // 退换货 --> 发货单
        },
        {
            component: import('../../store/action/My/ServiceListApproval'),
            path: '/My/serviceListApproval/:id' // 退换货 --> 待审核 服务单详情
        },
        {
            component: import('../../store/action/My/SelectExpress'),
            path: '/My/selectExpress' // 选择快递
        },
        {
            component: import('../../store/action/My/ServiceListHandle'),
            path: '/My/serviceListHandle/:id' // 退换货 --> 待审核  处理中的服务单详情
        },
        {
            component: import('../../store/action/My/Balance/MyBalance'),
            path: '/My/myBalance' // 我的余额
        },
        {
            component: import('../../store/action/My/Balance/Recharge'),
            path: '/My/Recharge' // 余额充值
        },
        {
            component: import('../../store/action/My/Balance/Putforward'),
            path: '/My/putforward' // 余额提现
        },
        {
            component: import('../../store/action/My/Balance/Bank'),
            path: '/My/bank' // 余额提现 选择银行
        },
        {
            component: import('../../store/action/My/Balance/MyBill'),
            path: '/My/mybill' // 余额提现 选择银行
        },
        {
            component: import('../../store/action/My/MyBeans'),
            path: '/My/myBeans' // 我的恒豆
        },
        {
            component: import('../../store/action/My/MyBeans/MyBeansOrder'),
            path: '/My/beansOrder' // 恒豆订单
        },
        {
            component: import('../../store/action/My/MyBeans/OrderDetail'),
            path: '/My/orderDetail/:id' // 恒豆订单详情
        },
        {
            component: import('../../store/action/My/MyBeans/SaleBeans'),
            path: '/My/saleBeans' // 出售恒豆
        },
        {
            component: import('../../store/action/My/MyBeans/MySoldList'),
            path: '/My/mySoldList' // 已出售恒豆
        },
        {
            component: import('../../store/action/My/MyBeans/MyHdBill'),
            path: '/My/myHdBill' // 已出售恒豆
        },
        {
            component: import('../../store/action/My/MyBeans/MySoldListDetail'),
            path: '/My/mySoldListDetail/:id' // 已出售恒豆详情
        },
        {
            component: import('../../store/action/My/Address'),
            path: '/My/address/:type' // 地址管理
        },
        {
            component: import('../../store/action/My/NewAddress'),
            path: '/My/newAddress' // 新建收货地址
        },
        {
            component: import('../../store/action/My/Hypothecation/Hypothecation'),
            path: '/My/hypothecation' // 债权管理
        },
        {
            component: import('../../store/action/My/Hypothecation/ExChangeList'),
            path: '/My/exChangeList' // 兑换记录
        },
        {
            component: import('../../store/action/My/Setting/Account'),
            path: '/My/account' // 设置中心
        },
        {
            component: import('../../store/action/My/Setting/Info'),
            path: '/My/info'
        },
        {
            component: import('../../store/action/My/Setting/ReName'),
            path: '/My/reName'
        },
        {
            component: import('../../store/action/My/Setting/Authentication'),
            path: '/My/authentication'
        },
        {
            component: import('../../store/action/My/Hypothecation/ExChangeStatistics'),
            path: '/My/exChangeStatistics' // 兑换统计
        },
        {
            component: import('../../store/action/My/Hypothecation/Signature'),
            path: '/My/signature' // 签章信息
        },
        {
            component: import('../../store/action/My/Hypothecation/FillInSignature'),
            path: '/My/fillInSignature' // 填写签章信息
        },
        {
            component: import('../../store/action/My/Hypothecation/ReceiveHD'),
            path: '/My/receiveHD' // 领取恒豆
        },
        {
            component: import('../../store/action/My/Hypothecation/ExChangeBeans'),
            path: '/My/exChangeBeans/:id' // 兑换恒豆
        },
        {
            component: import('../../store/action/My/DebtManagement/DebtManagement'),
            path: '/My/debtManagement' // 债务管理
        },
        {
            component: import('../../store/action/My/DebtManagement/ExChangeList'),
            path: '/My/debtExChangeList' // 兑换记录
        },
        {
            component: import('../../store/action/My/DebtManagement/ExChangeStatistics'),
            path: '/My/debtExChangeStatistics' // 兑换统计
        },
        {
            component: import('../../store/action/My/DebtManagement/ReceiveHD'),
            path: '/My/debtReceiveHD' // 领取恒豆
        },
        {
            component: import('../../store/action/My/DebtManagement/ExChangeBeans'),
            path: '/My/debtExChangeBeans/:id' // 兑换恒豆
        },
        {
            component: import('./Setting/AboutUs'),
            path: '/My/aboutUs' // 关于我们
        },
        {
            component: import('../../store/action/My/Setting/EditPhoneNumber'),
            path: '/My/editPhoneNumber' // 修改手机号
        },
        {
            component: import('../../store/action/My/Setting/EditPhoneNumberVerify'),
            path: '/My/editPhoneNumberVerify' // 修改手机号验证
        },
        {
            component: import('../../store/action/My/Setting/EditPswVerify'),
            path: '/My/editPswVerify' // 修改密码验证
        },
        {
            component: import('../../store/action/My/Setting/PayPswVerify'),
            path: '/My/payPswVerify' // 修改支付密码验证
        },
        {
            component: import('../../store/action/My/Setting/PayPswVerify'),
            path: '/My/payPswVerify' // 修改支付密码验证
        },
        {
            component: import('../../store/action/My/Setting/AuthenticationNewPass'),
            path: '/My/authenticationNewPass/:isSetNew' // 设置新的支付密码
        }
        ,
        {
            component: import('./Setting/UserIDAuthentication'),
            path: '/My/userIDAuthentication' // 实名认证
        }
    ]

    public render(): JSX.Element {
        return (
            <React.Fragment>
                <Switch>
                    <Route path="/My" exact={true} component={PersonalCenter} />
                    {
                        this.router.map((item: IRoutes, index: number) => {
                            return <Route path={item.path} component={loadable(item.component)} key={index} />
                        })
                    }
                </Switch>
            </React.Fragment>
        )
    }
}